package com.kestrel.space.common.utils;

import java.text.SimpleDateFormat;

/**
 * @author yebolin
 * @date 2024/8/21
 */
public class Generator {
    public static Long generateId(){
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSSS");
        String number = sdf.format(System.currentTimeMillis());//202211041552160219
        System.out.println("根据当前时间戳生成唯一：" + number);
        number = number.substring(2);
        System.out.println("优化后-根据当前时间戳生成唯一：" + number);//2211041552160219
        return Long.parseLong(number);
    }
}
